package com.itheima.App;

import com.itheima.Dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Booktest2 {
    public static void main(String[] args) {


        ApplicationContext ca = new ClassPathXmlApplicationContext("applicationContext.xml");
        BookDao bookDao = (BookDao) ca.getBean("bookDao");
        BookDao dao = (BookDao) ca.getBean("dao");
        System.out.println(bookDao);
        System.out.println(dao);
        //prototype是非单例,
        //com.itheima.Dao.impl.BookDaoimpl@25bbe1b6
        //com.itheima.Dao.impl.BookDaoimpl@5702b3b1
        // sington是单例
        //com.itheima.Dao.impl.BookDaoimpl@25bbe1b6
        //com.itheima.Dao.impl.BookDaoimpl@25bbe1b6
        //单利和非单例区别
        //1.单例是工厂初始化的时候加载，非单例是在调用的时候加载
        //2。对象个数不同，单例只创建一个对象，非单例用一次创建一个


    }
}